'
. '' . $title . "\n"
@@ -1062,8 +1071,15 @@ class Linker {
global $wgContLang;
$editurl = '§ion='.$section;
- $hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ) . '"';
- $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint );
+// WERELATE: distinguish section from topic, add hr, comment link
+ $hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( $nt->isTalkPage() ? 'edittopichint' : 'editsectionhint', htmlspecialchars( $hint ) ) . '"';
+ $url = $this->makeKnownLinkObj( $nt, wfMsg($nt->isTalkPage() ? 'edittopic' : 'editsection'), 'action=edit'.$editurl, '', '', '', $hint );
+ $hr = '';
+ $cmtLink = '';
+ if ($nt->isTalkPage()) {
+ $hr = ' ';
+ $cmtLink = '['. $this->makeKnownLinkObj( $nt, wfMsg('addcomment'), 'action=edit'.$editurl.'&cmt=new', '', '', '', ' title="' . wfMsgHtml('addcommenthint') . '"' ).'] ';
+ }
if( $wgContLang->isRTL() ) {
$farside = 'left';
@@ -1072,7 +1088,7 @@ class Linker {
$farside = 'right';
$nearside = 'left';
}
- return "[".$url."] ";
+ return "$hr{$cmtLink}[".$url."] ";
}
/**
diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php
index 9e25bf0..04d780b 100644
--- a/includes/LinksUpdate.php
+++ b/includes/LinksUpdate.php
@@ -57,8 +57,8 @@ class LinksUpdate {
$this->mCategories = $parserOutput->getCategories();
# Convert the format of the interlanguage links
- # I didn't want to change it in the ParserOutput, because that array is passed all
- # the way back to the skin, so either a skin API break would be required, or an
+ # I didn't want to change it in the ParserOutput, because that array is passed all
+ # the way back to the skin, so either a skin API break would be required, or an
# inefficient back-conversion.
$ill = $parserOutput->getLanguageLinks();
$this->mInterlangs = array();
@@ -85,7 +85,7 @@ class LinksUpdate {
function doIncrementalUpdate() {
$fname = 'LinksUpdate::doIncrementalUpdate';
wfProfileIn( $fname );
-
+
# Page links
$existing = $this->getExistingLinks();
$this->incrTableUpdate( 'pagelinks', 'pl', $this->getLinkDeletions( $existing ),
@@ -129,7 +129,7 @@ class LinksUpdate {
if ( $this->mRecursive ) {
$this->queueRecursiveJobs();
}
-
+
wfProfileOut( $fname );
}
@@ -170,13 +170,13 @@ class LinksUpdate {
function queueRecursiveJobs() {
wfProfileIn( __METHOD__ );
-
+
$batchSize = 100;
$dbr =& wfGetDB( DB_SLAVE );
- $res = $dbr->select( array( 'templatelinks', 'page' ),
+ $res = $dbr->select( array( 'templatelinks', 'page' ),
array( 'page_namespace', 'page_title' ),
- array(
- 'page_id=tl_from',
+ array(
+ 'page_id=tl_from',
'tl_namespace' => $this->mTitle->getNamespace(),
'tl_title' => $this->mTitle->getDBkey()
), __METHOD__
@@ -199,7 +199,7 @@ class LinksUpdate {
$dbr->freeResult( $res );
wfProfileOut( __METHOD__ );
}
-
+
/**
* Invalidate the cache of a list of pages from a single namespace
*
@@ -208,11 +208,11 @@ class LinksUpdate {
*/
function invalidatePages( $namespace, $dbkeys ) {
$fname = 'LinksUpdate::invalidatePages';
-
+
if ( !count( $dbkeys ) ) {
return;
}
-
+
/**
* Determine which pages need to be updated
* This is necessary to prevent the job queue from smashing the DB with
@@ -220,8 +220,8 @@ class LinksUpdate {
*/
$now = $this->mDb->timestamp();
$ids = array();
- $res = $this->mDb->select( 'page', array( 'page_id' ),
- array(
+ $res = $this->mDb->select( 'page', array( 'page_id' ),
+ array(
'page_namespace' => $namespace,
'page_title IN (' . $this->mDb->makeList( $dbkeys ) . ')',
'page_touched < ' . $this->mDb->addQuotes( $now )
@@ -233,14 +233,14 @@ class LinksUpdate {
if ( !count( $ids ) ) {
return;
}
-
+
/**
* Do the update
- * We still need the page_touched condition, in case the row has changed since
+ * We still need the page_touched condition, in case the row has changed since
* the non-locking select above.
*/
- $this->mDb->update( 'page', array( 'page_touched' => $now ),
- array(
+ $this->mDb->update( 'page', array( 'page_touched' => $now ),
+ array(
'page_id IN (' . $this->mDb->makeList( $ids ) . ')',
'page_touched < ' . $this->mDb->addQuotes( $now )
), $fname
@@ -410,7 +410,7 @@ class LinksUpdate {
/**
* Get an array of interlanguage link insertions
- * @param array $existing Array mapping existing language codes to titles
+ * @param array $existing Array mapping existing language codes to titles
* @private
*/
function getInterlangInsertions( $existing = array() ) {
@@ -469,7 +469,7 @@ class LinksUpdate {
return array_diff_key( $existing, $this->mImages );
}
- /**
+ /**
* Given an array of existing external links, returns those links which are not
* in $this and thus should be deleted.
* @private
@@ -487,7 +487,7 @@ class LinksUpdate {
return array_diff_assoc( $existing, $this->mCategories );
}
- /**
+ /**
* Given an array of existing interlanguage links, returns those links which are not
* in $this and thus should be deleted.
* @private
@@ -583,13 +583,13 @@ class LinksUpdate {
}
/**
- * Get an array of existing interlanguage links, with the language code in the key and the
+ * Get an array of existing interlanguage links, with the language code in the key and the
* title in the value.
* @private
*/
function getExistingInterlangs() {
$fname = 'LinksUpdate::getExistingInterlangs';
- $res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ),
+ $res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ),
array( 'll_from' => $this->mId ), $fname, $this->mOptions );
$arr = array();
while ( $row = $this->mDb->fetchObject( $res ) ) {
diff --git a/includes/Metadata.php b/includes/Metadata.php
index af40ab2..3f69c32 100644
--- a/includes/Metadata.php
+++ b/includes/Metadata.php
@@ -73,7 +73,7 @@ function wfCreativeCommonsRdf($article) {
function rdfSetup() {
global $wgOut, $_SERVER;
- $rdftype = wfNegotiateType(wfAcceptToPrefs($_SERVER['HTTP_ACCEPT']), wfAcceptToPrefs(RDF_TYPE_PREFS));
+ $rdftype = wfNegotiateType(wfAcceptToPrefs(@$_SERVER['HTTP_ACCEPT']), wfAcceptToPrefs(RDF_TYPE_PREFS));
if (!$rdftype) {
wfHttpError(406, "Not Acceptable", wfMsg("notacceptable"));
diff --git a/includes/Namespace.php b/includes/Namespace.php
index ab7511d..f565065 100644
--- a/includes/Namespace.php
+++ b/includes/Namespace.php
@@ -43,7 +43,7 @@ if( is_array( $wgExtraNamespaces ) ) {
*
* @package MediaWiki
*/
-class Namespace {
+class Namespac {
/**
* Check if the given namespace might be moved
@@ -58,14 +58,14 @@ class Namespace {
* @return bool
*/
function isMain( $index ) {
- return ! Namespace::isTalk( $index );
+ return ! Namespac::isTalk( $index );
}
/**
* Check if the give namespace is a talk page
* @return bool
*/
- function isTalk( $index ) {
+ static function isTalk( $index ) {
return ($index > NS_MAIN) // Special namespaces are negative
&& ($index % 2); // Talk namespaces are odd-numbered
}
@@ -73,8 +73,8 @@ class Namespace {
/**
* Get the talk namespace corresponding to the given index
*/
- function getTalk( $index ) {
- if ( Namespace::isTalk( $index ) ) {
+ static function getTalk( $index ) {
+ if ( Namespac::isTalk( $index ) ) {
return $index;
} else {
# FIXME
@@ -83,7 +83,7 @@ class Namespace {
}
function getSubject( $index ) {
- if ( Namespace::isTalk( $index ) ) {
+ if ( Namespac::isTalk( $index ) ) {
return $index - 1;
} else {
return $index;
diff --git a/includes/ObjectCache.php b/includes/ObjectCache.php
index fe7417d..c10f532 100644
--- a/includes/ObjectCache.php
+++ b/includes/ObjectCache.php
@@ -53,19 +53,62 @@ function &wfGetCache( $inputType ) {
require_once( 'memcached-client.php' );
if (!class_exists("MemcachedClientforWiki")) {
- class MemCachedClientforWiki extends memcached {
+ class MemCachedClientforWiki extends MWmemcached {
+// WERELATE - added functions to call prepareKey before entering memcached
+ function prepareKey($key) {
+ return str_replace(' ','_',$key);
+ }
+
+ function add ($key, $val, $exp = 0)
+ {
+ return parent::add($this->prepareKey($key), $val, $exp);
+ }
+ function decr ($key, $amt=1)
+ {
+ return parent::decr($this->prepareKey($key), $amt);
+ }
+ function delete ($key, $time = 0)
+ {
+ return parent::delete($this->prepareKey($key), $time);
+ }
+ function get ($key)
+ {
+ return parent::get($this->prepareKey($key));
+ }
+ function get_multi ($keys)
+ {
+ $pKeys = array();
+ foreach ($keys as $key)
+ {
+ $pKeys[] = $this->prepareKey($key);
+ }
+ return parent::get_multi($pKeys);
+ }
+ function incr ($key, $amt=1)
+ {
+ return parent::incr($this->prepareKey($key), $amt);
+ }
+ function replace ($key, $value, $exp=0)
+ {
+ return parent::replace($this->prepareKey($key), $value, $exp);
+ }
+ function set ($key, $value, $exp=0)
+ {
+ return parent::set($this->prepareKey($key), $value, $exp);
+ }
function _debugprint( $text ) {
wfDebug( "memcached: $text\n" );
}
}
}
- $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
+// WERELATE - changed CACHE_DB to CACHE_MEMCACHED and moved assignment outside IF
+ $wgCaches[CACHE_MEMCACHED] = new MemCachedClientforWiki(
array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
- $cache =& $wgCaches[CACHE_DB];
- $cache->set_servers( $wgMemCachedServers );
- $cache->set_debug( $wgMemCachedDebug );
+ $wgCaches[CACHE_MEMCACHED]->set_servers( $wgMemCachedServers );
+ $wgCaches[CACHE_MEMCACHED]->set_debug( $wgMemCachedDebug );
}
+ $cache =& $wgCaches[CACHE_MEMCACHED];
} elseif ( $type == CACHE_ACCEL ) {
if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
if ( function_exists( 'eaccelerator_get' ) ) {
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 31a0781..4d38331 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -26,7 +26,7 @@ class OutputPage {
var $mShowFeedLinks = false;
var $mEnableClientCache = true;
var $mArticleBodyOnly = false;
-
+
var $mNewSectionLink = false;
var $mNoGallery = false;
@@ -53,8 +53,14 @@ class OutputPage {
$this->mRevisionId = null;
$this->mNewSectionLink = false;
}
-
- function redirect( $url, $responsecode = '302' ) {
+
+ function redirect( $url, $responsecode = '302' ) {
+ # WR DWQ
+ global $wrProtocol;
+ if ( substr( $url, 0, 7 ) === "http://" && $wrProtocol = "https" ) {
+ $url = $wrProtocol . "://" . substr( $url, 7);
+ }
+
# Strip newlines as a paranoia check for header injection in PHP<5.1.2
$this->mRedirect = str_replace( "\n", '', $url );
$this->mRedirectCode = $responsecode;
@@ -341,9 +347,18 @@ class OutputPage {
* For anything that isn't primary text or interface message
*/
function addSecondaryWikiText( $text, $linestart = true ) {
- global $wgTitle;
+ global $wgTitle, $wgParser;
$this->mParserOptions->setTidy(true);
- $this->addWikiTextTitle($text, $wgTitle, $linestart);
+
+// WERELATE - replace call to addWikiTextTitle with function contents so I can add call to hook
+ $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions,
+ $linestart, true, $this->mRevisionId );
+ $this->addParserOutputNoText( $parserOutput );
+ $text = $parserOutput->getText();
+ wfRunHooks( 'OutputPageBeforeHTML',array( &$this, &$text ) );
+ $parserOutput->setText( $text );
+ $this->addHTML( $parserOutput->getText() );
+
$this->mParserOptions->setTidy(false);
}
@@ -386,6 +401,9 @@ class OutputPage {
$this->addKeywords( $parserOutput );
$this->mNewSectionLink = $parserOutput->getNewSection();
$this->mNoGallery = $parserOutput->getNoGallery();
+ // WERELATE
+ $this->mSubtitle .= $parserOutput->mSubtitle;
+
$text = $parserOutput->getText();
wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
$this->addHTML( $text );
@@ -489,13 +507,14 @@ class OutputPage {
wfProfileIn( $fname );
$sk = $wgUser->getSkin();
- if ( $wgUseAjax ) {
- $this->addScript( "" );
- $this->addScript( "\n" );
- }
+// WERELATE - remove
+// if ( $wgUseAjax ) {
+// $this->addScript( "" );
+// $this->addScript( "\n" );
+// }
if ( '' != $this->mRedirect ) {
if( substr( $this->mRedirect, 0, 4 ) != 'http' ) {
@@ -663,7 +682,7 @@ class OutputPage {
$link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]";
$this->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name ) );
-
+
# Don't auto-return to special pages
if( $return ) {
$return = $wgTitle->getNamespace() > -1 ? $wgTitle->getPrefixedText() : NULL;
@@ -695,7 +714,7 @@ class OutputPage {
function errorpage( $title, $msg ) {
throw new ErrorPageError( $title, $msg );
}
-
+
/**
* Display an error page indicating that a given version of MediaWiki is
* required to use it
@@ -775,17 +794,17 @@ class OutputPage {
function loginToUse() {
global $wgUser, $wgTitle, $wgContLang;
$skin = $wgUser->getSkin();
-
+
$this->setPageTitle( wfMsg( 'loginreqtitle' ) );
$this->setHtmlTitle( wfMsg( 'errorpagetitle' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
$this->setArticleFlag( false );
-
+
$loginTitle = Title::makeTitle( NS_SPECIAL, 'Userlogin' );
$loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
$this->addHtml( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
$this->addHtml( "\n" );
-
+
$this->returnToMain();
}
@@ -804,7 +823,7 @@ class OutputPage {
$skin = $wgUser->getSkin();
$this->setPageTitle( wfMsg( 'viewsource' ) );
$this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
-
+
# Determine if protection is due to the page being a system message
# and show an appropriate explanation
if( $wgTitle->getNamespace() == NS_MEDIAWIKI && !$wgUser->isAllowed( 'editinterface' ) ) {
@@ -833,7 +852,7 @@ class OutputPage {
}
$rows = $wgUser->getIntOption( 'rows' );
$cols = $wgUser->getIntOption( 'cols' );
-
+
$text = "\n";
$this->addHTML( $text );
@@ -843,10 +862,10 @@ class OutputPage {
}
/** @obsolete */
- function fatalError( $message ) {
- throw new FatalError( $message );
+ function fatalError( $message ) {
+ throw new FatalError( $message );
}
-
+
/** @obsolete */
function unexpectedValueError( $name, $val ) {
throw new FatalError( wfMsg( 'unexpected', $name, $val ) );
@@ -908,15 +927,21 @@ class OutputPage {
*/
function returnToMain( $auto = true, $returnto = NULL ) {
global $wgUser, $wgOut, $wgRequest;
-
+
if ( $returnto == NULL ) {
$returnto = $wgRequest->getText( 'returnto' );
}
-
+
if ( '' === $returnto ) {
$returnto = wfMsgForContent( 'mainpage' );
}
+// WERELATE - use page title for link text of MyRelate when we makeLinkObj below
+ $linkText = '';
+ if ($returnto == 'Special:MyRelate') {
+ $linkText = wfmsg('myrelate');
+ }
+
if ( is_object( $returnto ) ) {
$titleObj = $returnto;
} else {
@@ -927,12 +952,13 @@ class OutputPage {
}
$sk = $wgUser->getSkin();
- $link = $sk->makeLinkObj( $titleObj, '' );
+ $link = $sk->makeLinkObj( $titleObj, $linkText );
$r = wfMsg( 'returnto', $link );
- if ( $auto ) {
- $wgOut->addMeta( 'http:Refresh', '10;url=' . $titleObj->escapeFullURL() );
- }
+// WERELATE - don't automatically redirect
+// if ( $auto ) {
+// $wgOut->addMeta( 'http:Refresh', '10;url=' . $titleObj->escapeFullURL() );
+// }
$wgOut->addHTML( "\n$r \n" );
}
@@ -1060,11 +1086,12 @@ class OutputPage {
function rateLimited() {
global $wgOut;
$wgOut->disable();
+// WERELATE: changed message
wfHttpError( 500, 'Internal Server Error',
- 'Sorry, the server has encountered an internal error. ' .
+ 'Sorry, to discourage spammers we limit the number of edits that can be made in a short period of time. ' .
'Please wait a moment and hit "refresh" to submit the request again.' );
}
-
+
/**
* Show an "add new section" link?
*
diff --git a/includes/Parser.php b/includes/Parser.php
index 31976ba..a7ba53b 100644
--- a/includes/Parser.php
+++ b/includes/Parser.php
@@ -174,12 +174,12 @@ class Parser
if ( $wgAllowSlowParserFunctions ) {
$this->setFunctionHook( MAG_PAGESINNAMESPACE, array( 'CoreParserFunctions', 'pagesinnamespace' ), SFH_NO_HASH );
}
-
+
$this->initialiseVariables();
$this->mFirstCall = false;
wfProfileOut( __METHOD__ );
- }
+ }
/**
* Clear Parser state
@@ -210,7 +210,7 @@ class Parser
'titles' => array()
);
$this->mRevisionId = null;
-
+
/**
* Prefix for temporary replacement strings for the multipass parser.
* \x07 should never appear in input as it's disallowed in XML.
@@ -321,8 +321,8 @@ class Parser
} else {
# attempt to sanitize at least some nesting problems
# (bug #2702 and quite a few others)
- $tidyregs = array(
- # ''Something [http://www.cool.com cool''] -->
+ $tidyregs = array(
+ # ''Something [http://www.cool.com cool''] -->
# Somethingcool>
'/(<([bi])>)(<([bi])>)?([^<]*)(<\/?a[^<]*>)([^<]*)(<\/\\4>)?(<\/\\2>)/' =>
'\\1\\3\\5\\8\\9\\6\\1\\3\\7\\8\\9',
@@ -337,10 +337,10 @@ class Parser
'\\1\\3<div\\5>\\6</div>\\8\\9',
# remove empty italic or bold tag pairs, some
# introduced by rules above
- '/<([bi])><\/\\1>/' => ''
+ '/<([bi])><\/\\1>/' => ''
);
- $text = preg_replace(
+ $text = preg_replace(
array_keys( $tidyregs ),
array_values( $tidyregs ),
$text );
@@ -444,7 +444,7 @@ class Parser
$text = $q[2];
}
}
-
+
$matches[$marker] = array( $element,
$content,
Sanitizer::decodeTagAttributes( $attributes ),
@@ -463,7 +463,7 @@ class Parser
* will be stripped in addition to other tags. This is important
* for section editing, where these comments cause confusion when
* counting the sections in the wikisource
- *
+ *
* @param array dontstrip contains tags which should not be stripped;
* used to prevent stipping of when saving (fixes bug 2700)
*
@@ -476,7 +476,7 @@ class Parser
$uniq_prefix = $this->mUniqPrefix;
#$text = str_replace( $uniq_prefix, wfHtmlEscapeFirst( $uniq_prefix ), $text );
$commentState = array();
-
+
$elements = array_merge(
array( 'nowiki', 'gallery' ),
array_keys( $this->mTagHooks ) );
@@ -487,13 +487,13 @@ class Parser
if( $this->mOptions->getUseTeX() ) {
$elements[] = 'math';
}
-
+
# Removing $dontstrip tags from $elements list (currently only 'gallery', fixing bug 2700)
foreach ( $elements AS $k => $v ) {
if ( !in_array ( $v , $dontstrip ) ) continue;
unset ( $elements[$k] );
}
-
+
$matches = array();
$text = Parser::extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
@@ -545,7 +545,7 @@ class Parser
$state[$element][$marker] = $output;
}
}
-
+
# Unstrip comments unless explicitly told otherwise.
# (The comments are always stripped prior to this point, so as to
# not invoke any extension tags / parser hooks contained within
@@ -797,13 +797,13 @@ class Parser
}
$after = substr ( $x , 1 ) ;
if ( $fc == '!' ) $after = str_replace ( '!!' , '||' , $after ) ;
-
+
// Split up multiple cells on the same line.
// FIXME: This can result in improper nesting of tags processed
// by earlier parser steps, but should avoid splitting up eg
// attribute values containing literal "||".
$after = wfExplodeMarkup( '||', $after );
-
+
$t[$k] = '' ;
# Loop through each table cell
@@ -881,7 +881,7 @@ class Parser
$text = strtr( $text, array( '' => '' , '' => '' ) );
$text = strtr( $text, array( '' => '', '' => '') );
$text = preg_replace( '/.*?<\/includeonly>/s', '', $text );
-
+
$text = Sanitizer::removeHTMLtags( $text, array( &$this, 'attributeStripCallback' ) );
$text = $this->replaceVariables( $text, $args );
@@ -1197,7 +1197,7 @@ class Parser
# Normalize any HTML entities in input. They will be
# re-escaped by makeExternalLink().
$url = Sanitizer::decodeCharReferences( $url );
-
+
# Escape any control characters introduced by the above step
$url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url );
@@ -1248,10 +1248,10 @@ class Parser
# special case: handle urls as url args:
# http://www.example.com/foo?=http://www.example.com/bar
- if(strlen($trail) == 0 &&
+ if(strlen($trail) == 0 &&
isset($bits[$i]) &&
preg_match('/^'. wfUrlProtocols() . '$/S', $bits[$i]) &&
- preg_match( '/^('.EXT_LINK_URL_CLASS.'+)(.*)$/s', $bits[$i + 1], $m ))
+ preg_match( '/^('.EXT_LINK_URL_CLASS.'+)(.*)$/s', $bits[$i + 1], $m ))
{
# add protocol, arg
$url .= $bits[$i] . $m[1]; # protocol, url as arg to previous link
@@ -1283,7 +1283,7 @@ class Parser
# Normalize any HTML entities in input. They will be
# re-escaped by makeExternalLink() or maybeMakeExternalImage()
$url = Sanitizer::decodeCharReferences( $url );
-
+
# Escape any control characters introduced by the above step
$url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url );
@@ -1448,16 +1448,16 @@ class Parser
# Still some problems for cases where the ] is meant to be outside punctuation,
# and no image is in sight. See bug 2095.
#
- if( $text !== '' &&
- preg_match( "/^\](.*)/s", $m[3], $n ) &&
- strpos($text, '[') !== false
- )
+ if( $text !== '' &&
+ preg_match( "/^\](.*)/s", $m[3], $n ) &&
+ strpos($text, '[') !== false
+ )
{
$text .= ']'; # so that replaceExternalLinks($text) works later
$m[3] = $n[1];
}
# fix up urlencoded title texts
- if(preg_match('/%/', $m[1] ))
+ if(preg_match('/%/', $m[1] ))
# Should anchors '#' also be rejected?
$m[1] = str_replace( array('<', '>'), array('<', '>'), urldecode($m[1]) );
$trail = $m[3];
@@ -2049,14 +2049,14 @@ class Parser
function findColonNoLinks($str, &$before, &$after) {
$fname = 'Parser::findColonNoLinks';
wfProfileIn( $fname );
-
+
$pos = strpos( $str, ':' );
if( $pos === false ) {
// Nothing to find!
wfProfileOut( $fname );
return false;
}
-
+
$lt = strpos( $str, '<' );
if( $lt === false || $lt > $pos ) {
// Easy; no tag nesting to worry about
@@ -2065,14 +2065,14 @@ class Parser
wfProfileOut( $fname );
return $pos;
}
-
+
// Ugly state machine to walk through avoiding tags.
$state = MW_COLON_STATE_TEXT;
$stack = 0;
$len = strlen( $str );
for( $i = 0; $i < $len; $i++ ) {
$c = $str{$i};
-
+
switch( $state ) {
// (Using the number is a performance hack for common cases)
case 0: // MW_COLON_STATE_TEXT:
@@ -2574,7 +2574,7 @@ class Parser
wfProfileOut( $fname );
return $text;
}
-
+
/**
* Replace magic variables
* @private
@@ -2704,13 +2704,13 @@ class Parser
$mwMsg =& MagicWord::get( MAG_MSG );
$mwMsg->matchStartAndRemove( $part1 );
}
-
+
# Check for RAW:
$mwRaw =& MagicWord::get( MAG_RAW );
if ( $mwRaw->matchStartAndRemove( $part1 ) ) {
$forceRawInterwiki = true;
}
-
+
# Check if it is an internal message
$mwInt =& MagicWord::get( MAG_INT );
if ( $mwInt->matchStartAndRemove( $part1 ) ) {
@@ -2724,7 +2724,7 @@ class Parser
# Parser functions
if ( !$found ) {
wfProfileIn( __METHOD__ . '-pfunc' );
-
+
$colonPos = strpos( $part1, ':' );
if ( $colonPos !== false ) {
# Case sensitive functions
@@ -2764,7 +2764,7 @@ class Parser
}
}
}
- wfProfileOut( __METHOD__ . '-pfunc' );
+ wfProfileOut( __METHOD__ . '-pfunc' );
}
# Template table test
@@ -2852,7 +2852,7 @@ class Parser
}
$found = true;
}
-
+
# Template cache array insertion
# Use the original $piece['title'] not the mangled $part1, so that
# modifiers such as RAW: produce separate cache entries
@@ -2865,7 +2865,7 @@ class Parser
$text = $linestart . $text;
}
}
- wfProfileOut( __METHOD__ . '-loadtpl' );
+ wfProfileOut( __METHOD__ . '-loadtpl' );
}
# Recursive parsing, escaping and link table handling
@@ -3112,15 +3112,15 @@ class Parser
if( $mw->matchAndRemove( $text ) ) {
$this->mShowToc = false;
}
-
+
$mw = MagicWord::get( MAG_TOC );
if( $mw->match( $text ) ) {
$this->mShowToc = true;
$this->mForceTocPosition = true;
-
+
// Set a placeholder. At the end we'll fill it in with the TOC.
$text = $mw->replace( '', $text, 1 );
-
+
// Only keep the first one.
$text = $mw->replace( '', $text );
}
@@ -3476,7 +3476,7 @@ class Parser
$text .= $keyword . $x;
continue;
}
-
+
$id = $blank = '' ;
/** remove and save whitespaces in $blank */
@@ -3569,10 +3569,10 @@ class Parser
# Variable replacement
# Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
$text = $this->replaceVariables( $text );
-
+
# Strip out etc. added via replaceVariables
$text = $this->strip( $text, $stripState, false, array( 'gallery' ) );
-
+
# Signatures
$sigText = $this->getUserSig( $user );
$text = strtr( $text, array(
@@ -3631,7 +3631,7 @@ class Parser
$username = $user->getName();
$nickname = $user->getOption( 'nickname' );
$nickname = $nickname === '' ? $username : $nickname;
-
+
if( $user->getBoolOption( 'fancysig' ) !== false ) {
# Sig. might contain markup; validate this
if( $this->validateSig( $nickname ) !== false ) {
@@ -3661,7 +3661,7 @@ class Parser
function validateSig( $text ) {
return( wfIsWellFormedXmlFragment( $text ) ? $text : false );
}
-
+
/**
* Clean up signature text
*
@@ -3675,7 +3675,7 @@ class Parser
function cleanSig( $text, $parsing = false ) {
global $wgTitle;
$this->startExternalParse( $wgTitle, new ParserOptions(), $parsing ? OT_WIKI : OT_MSG );
-
+
$substWord = MagicWord::get( MAG_SUBST );
$substRegex = '/\{\{(?!(?:' . $substWord->getBaseRegex() . '))/x' . $substWord->getRegexCase();
$substText = '{{' . $substWord->getSynonym( 0 );
@@ -3683,8 +3683,8 @@ class Parser
$text = preg_replace( $substRegex, $substText, $text );
$text = $this->cleanSigInSig( $text );
$text = $this->replaceVariables( $text );
-
- $this->clearState();
+
+ $this->clearState();
return $text;
}
@@ -3697,7 +3697,7 @@ class Parser
$text = preg_replace( '/~{3,5}/', '', $text );
return $text;
}
-
+
/**
* Set up some variables which are usually set up in parse()
* so that an external function can call some class members with confidence
@@ -3773,10 +3773,10 @@ class Parser
* The callback function should have the form:
* function myParserFunction( &$parser, $arg1, $arg2, $arg3 ) { ... }
*
- * The callback may either return the text result of the function, or an array with the text
- * in element 0, and a number of flags in the other elements. The names of the flags are
+ * The callback may either return the text result of the function, or an array with the text
+ * in element 0, and a number of flags in the other elements. The names of the flags are
* specified in the keys. Valid flags are:
- * found The text returned is valid, stop processing the template. This
+ * found The text returned is valid, stop processing the template. This
* is on by default.
* nowiki Wiki markup in the return value should be escaped
* noparse Unsafe HTML tags should not be stripped, etc.
@@ -3787,7 +3787,7 @@ class Parser
*
* @param mixed $id The magic word ID, or (deprecated) the function name. Function names are case-insensitive.
* @param mixed $callback The callback function (and object) to use
- * @param integer $flags a combination of the following flags:
+ * @param integer $flags a combination of the following flags:
* SFH_NO_HASH No leading hash, i.e. {{plural:...}} instead of {{#if:...}}
*
* @return The old callback function for this name, if any
@@ -4033,13 +4033,13 @@ class Parser
function renderPreTag( $text, $attribs, $parser ) {
// Backwards-compatibility hack
$content = preg_replace( '!(.*?)!is', '\\1', $text );
-
+
$attribs = Sanitizer::validateTagAttributes( $attribs, 'pre' );
return wfOpenElement( 'pre', $attribs ) .
wfEscapeHTMLTagsOnly( $content ) .
'';
}
-
+
/**
* Renders an image gallery from a text with one line per image.
* text labels may be given by using |-style alternative text. E.g.
@@ -4058,7 +4058,7 @@ class Parser
if( isset( $params['caption'] ) )
$ig->setCaption( $params['caption'] );
-
+
$lines = explode( "\n", $text );
foreach ( $lines as $line ) {
# match lines like these:
@@ -4170,7 +4170,7 @@ class Parser
# make sure there are no placeholders in thumbnail attributes
# that are later expanded to html- so expand them now and
# remove the tags
- $alt = $this->unstrip($alt, $this->mStripState);
+ $alt = $this->unstrip($alt, $this->mStripState);
$alt = Sanitizer::stripAllTags( $alt );
# Linker does the rest
@@ -4242,14 +4242,14 @@ class Parser
# strip NOWIKI etc. to avoid confusion (true-parameter causes HTML
# comments to be stripped as well)
$striparray = array();
-
+
$oldOutputType = $this->mOutputType;
$oldOptions = $this->mOptions;
$this->mOptions = new ParserOptions();
$this->mOutputType = OT_WIKI;
-
+
$striptext = $this->strip( $text, $striparray, true );
-
+
$this->mOutputType = $oldOutputType;
$this->mOptions = $oldOptions;
@@ -4293,7 +4293,7 @@ class Parser
/mix",
$striptext, -1,
PREG_SPLIT_DELIM_CAPTURE);
-
+
if( $mode == "get" ) {
if( $section == 0 ) {
// "Section 0" returns the content before any other section.
@@ -4360,7 +4360,7 @@ class Parser
$rv = trim( $rv );
return $rv;
}
-
+
/**
* This function returns the text of a section, specified by a number ($section).
* A section is text under a heading like == Heading == or \Heading\, or
@@ -4375,7 +4375,7 @@ class Parser
function getSection( $text, $section ) {
return $this->extractSections( $text, $section, "get" );
}
-
+
function replaceSection( $oldtext, $section, $text ) {
return $this->extractSections( $oldtext, $section, "replace", $text );
}
@@ -4448,7 +4448,7 @@ class ParserOutput
function addImage( $name ) { $this->mImages[$name] = 1; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; }
-
+
function setNewSection( $value ) {
$this->mNewSection = (bool)$value;
}
diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php
index bed79c1..e99cb95 100644
--- a/includes/ProxyTools.php
+++ b/includes/ProxyTools.php
@@ -43,6 +43,10 @@ function wfGetIP() {
# Get list of trusted proxies
# Flipped for quicker access
$trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) );
+ # WERELATE
+ if ( substr($ip, 0, 3) === '10.' ) { # we're behind a load balancer, which can change its IP from time to time, but always starts with 10.
+ $trustedProxies[$ip] = true;
+ }
if ( count( $trustedProxies ) ) {
# Append XFF on to $ipchain
$forwardedFor = wfGetForwardedFor();
diff --git a/includes/RecentChange.php b/includes/RecentChange.php
index f320a47..57a251a 100644
--- a/includes/RecentChange.php
+++ b/includes/RecentChange.php
@@ -200,7 +200,7 @@ class RecentChange
$oldId, $lastTimestamp, $bot = "default", $ip = '', $oldSize = 0, $newSize = 0,
$newId = 0)
{
- if ( $bot == 'default' ) {
+ if ($bot === 'default') {
$bot = $user->isBot();
}
@@ -341,7 +341,7 @@ class RecentChange
# A log entry is different to an edit in that previous revisions are
# not kept
/*static*/ function notifyLog( $timestamp, &$title, &$user, $comment, $ip='',
- $type, $action, $target, $logComment, $params )
+ $type, $action, $target, $logComment, $params, $minor = 0, $patrolled = 1) // WERELATE - added minor, patrolled
{
if ( !$ip ) {
$ip = wfGetIP();
@@ -357,7 +357,7 @@ class RecentChange
'rc_namespace' => $title->getNamespace(),
'rc_title' => $title->getDBkey(),
'rc_type' => RC_LOG,
- 'rc_minor' => 0,
+ 'rc_minor' => $minor ? 1 : 0,
'rc_cur_id' => $title->getArticleID(),
'rc_user' => $user->getID(),
'rc_user_text' => $user->getName(),
@@ -368,7 +368,7 @@ class RecentChange
'rc_moved_to_ns' => 0,
'rc_moved_to_title' => '',
'rc_ip' => $ip,
- 'rc_patrolled' => 1,
+ 'rc_patrolled' => $patrolled ? 1 : 0,
'rc_new' => 0 # obsolete
);
$rc->mExtra = array(
@@ -452,7 +452,7 @@ class RecentChange
$titleObj =& $this->getTitle();
if ( $rc_type == RC_LOG ) {
- $title = Namespace::getCanonicalName( $titleObj->getNamespace() ) . $titleObj->getText();
+ $title = Namespac::getCanonicalName( $titleObj->getNamespace() ) . $titleObj->getText();
} else {
$title = $titleObj->getPrefixedText();
}
diff --git a/includes/Revision.php b/includes/Revision.php
index 653bacb..1bb1425 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -25,7 +25,7 @@ class Revision {
* @static
* @access public
*/
- function newFromId( $id ) {
+ static function newFromId( $id ) {
return Revision::newFromConds(
array( 'page_id=rev_page',
'rev_id' => intval( $id ) ) );
@@ -42,7 +42,7 @@ class Revision {
* @access public
* @static
*/
- function newFromTitle( &$title, $id = 0 ) {
+ static function newFromTitle( &$title, $id = 0 ) {
if( $id ) {
$matchId = intval( $id );
} else {
@@ -66,7 +66,7 @@ class Revision {
* @return Revision
* @access public
*/
- function loadFromPageId( &$db, $pageid, $id = 0 ) {
+ static function loadFromPageId( &$db, $pageid, $id = 0 ) {
$conds=array('page_id=rev_page','rev_page'=>intval( $pageid ), 'page_id'=>intval( $pageid ));
if( $id ) {
$conds['rev_id']=intval($id);
@@ -130,7 +130,7 @@ class Revision {
* @static
* @access private
*/
- function newFromConds( $conditions ) {
+ static function newFromConds( $conditions ) {
$db =& wfGetDB( DB_SLAVE );
$row = Revision::loadFromConds( $db, $conditions );
if( is_null( $row ) ) {
@@ -150,7 +150,7 @@ class Revision {
* @static
* @access private
*/
- function loadFromConds( &$db, $conditions ) {
+ static function loadFromConds( &$db, $conditions ) {
$res = Revision::fetchFromConds( $db, $conditions );
if( $res ) {
$row = $res->fetchObject();
@@ -192,7 +192,7 @@ class Revision {
* @static
* @access public
*/
- function fetchRevision( &$title ) {
+ static function fetchRevision( &$title ) {
return Revision::fetchFromConds(
wfGetDB( DB_SLAVE ),
array( 'rev_id=page_latest',
@@ -212,7 +212,7 @@ class Revision {
* @static
* @access private
*/
- function fetchFromConds( &$db, $conditions ) {
+ static function fetchFromConds( &$db, $conditions ) {
$res = $db->select(
array( 'page', 'revision' ),
array( 'page_namespace',
diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php
index f5a24df..8bf53e7 100644
--- a/includes/Sanitizer.php
+++ b/includes/Sanitizer.php
@@ -921,7 +921,7 @@ class Sanitizer {
* @return string
* @public
*/
- function decodeCharReferences( $text ) {
+ static function decodeCharReferences( $text ) {
return preg_replace_callback(
MW_CHAR_REFS_REGEX,
array( 'Sanitizer', 'decodeCharReferencesCallback' ),
@@ -932,7 +932,7 @@ class Sanitizer {
* @param string $matches
* @return string
*/
- function decodeCharReferencesCallback( $matches ) {
+ static function decodeCharReferencesCallback( $matches ) {
if( $matches[1] != '' ) {
return Sanitizer::decodeEntity( $matches[1] );
} elseif( $matches[2] != '' ) {
@@ -953,7 +953,7 @@ class Sanitizer {
* @return string
* @private
*/
- function decodeChar( $codepoint ) {
+ static function decodeChar( $codepoint ) {
if( Sanitizer::validateCodepoint( $codepoint ) ) {
return codepointToUtf8( $codepoint );
} else {
@@ -969,7 +969,7 @@ class Sanitizer {
* @param string $name
* @return string
*/
- function decodeEntity( $name ) {
+ static function decodeEntity( $name ) {
global $wgHtmlEntities;
if( isset( $wgHtmlEntities[$name] ) ) {
return codepointToUtf8( $wgHtmlEntities[$name] );
diff --git a/includes/SiteStatsUpdate.php b/includes/SiteStatsUpdate.php
index 1b6d380..995493e 100644
--- a/includes/SiteStatsUpdate.php
+++ b/includes/SiteStatsUpdate.php
@@ -39,7 +39,8 @@ class SiteStatsUpdate {
$dbw =& wfGetDB( DB_MASTER );
# First retrieve the row just to find out which schema we're in
- $row = $dbw->selectRow( 'site_stats', '*', false, $fname );
+ // WERELATE - comment out unnecessary database read
+// $row = $dbw->selectRow( 'site_stats', '*', false, $fname );
$updates = '';
@@ -47,31 +48,31 @@ class SiteStatsUpdate {
$this->appendUpdate( $updates, 'ss_total_edits', $this->mEdits );
$this->appendUpdate( $updates, 'ss_good_articles', $this->mGood );
- if ( isset( $row->ss_total_pages ) ) {
+// if ( isset( $row->ss_total_pages ) ) {
# Update schema if required
- if ( $row->ss_total_pages == -1 && !$this->mViews ) {
- $dbr =& wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') );
- extract( $dbr->tableNames( 'page', 'user' ) );
+// if ( $row->ss_total_pages == -1 && !$this->mViews ) {
+// $dbr =& wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') );
+// extract( $dbr->tableNames( 'page', 'user' ) );
- $sql = "SELECT COUNT(page_namespace) AS total FROM $page";
- $res = $dbr->query( $sql, $fname );
- $pageRow = $dbr->fetchObject( $res );
- $pages = $pageRow->total + $this->mPages;
+// $sql = "SELECT COUNT(page_namespace) AS total FROM $page";
+// $res = $dbr->query( $sql, $fname );
+// $pageRow = $dbr->fetchObject( $res );
+// $pages = $pageRow->total + $this->mPages;
- $sql = "SELECT COUNT(user_id) AS total FROM $user";
- $res = $dbr->query( $sql, $fname );
- $userRow = $dbr->fetchObject( $res );
- $users = $userRow->total + $this->mUsers;
+// $sql = "SELECT COUNT(user_id) AS total FROM $user";
+// $res = $dbr->query( $sql, $fname );
+// $userRow = $dbr->fetchObject( $res );
+// $users = $userRow->total + $this->mUsers;
- if ( $updates ) {
- $updates .= ',';
- }
- $updates .= "ss_total_pages=$pages, ss_users=$users";
- } else {
+// if ( $updates ) {
+// $updates .= ',';
+// }
+// $updates .= "ss_total_pages=$pages, ss_users=$users";
+// } else {
$this->appendUpdate( $updates, 'ss_total_pages', $this->mPages );
$this->appendUpdate( $updates, 'ss_users', $this->mUsers );
- }
- }
+// }
+// }
if ( $updates ) {
$site_stats = $dbw->tableName( 'site_stats' );
$sql = $dbw->limitResultForUpdate("UPDATE $site_stats SET $updates", 1);
diff --git a/includes/Skin.php b/includes/Skin.php
index 8a03f46..ddf2809 100644
--- a/includes/Skin.php
+++ b/includes/Skin.php
@@ -109,7 +109,7 @@ class Skin extends Linker {
*/
function &newFromKey( $key ) {
global $wgStyleDirectory;
-
+
$key = Skin::normalizeKey( $key );
$skinNames = Skin::getSkinNames();
@@ -169,7 +169,7 @@ class Skin extends Linker {
$this->addMetadataLinks($out);
$this->mRevisionId = $out->mRevisionId;
-
+
$this->preloadExistence();
wfProfileOut( $fname );
@@ -186,14 +186,14 @@ class Skin extends Linker {
} else {
$otherTab = $wgTitle->getTalkPage();
}
- $lb = new LinkBatch( array(
+ $lb = new LinkBatch( array(
$wgUser->getUserPage(),
$wgUser->getTalkPage(),
$otherTab
));
$lb->execute();
}
-
+
function addMetadataLinks( &$out ) {
global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
global $wgRightsPage, $wgRightsUrl;
@@ -262,7 +262,8 @@ class Skin extends Linker {
function getHeadScripts() {
global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType;
- $r = "\n";
+// WERELATE - already included
+// $r = "\n";
if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
$userpage = $wgUser->getUserPage();
$userjs = htmlspecialchars( $this->makeUrl(
@@ -654,7 +655,8 @@ END;
(($wgTitle->getArticleId() == 0) || ($action == "history")) &&
($n = $wgTitle->isDeleted() ) )
{
- if ( $wgUser->isAllowed( 'delete' ) ) {
+// WERELATE: added title parm; undelete action
+ if ( $wgUser->isAllowed( 'undelete', $wgTitle ) ) {
$msg = 'thisisdeleted';
} else {
$msg = 'viewdeleted';
@@ -871,7 +873,8 @@ END;
}
if ( $wgTitle->getArticleId() ) {
$s .= "\n ";
- if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); }
+// WERELATE: added title parm
+ if($wgUser->isAllowed('delete', $wgTitle)) { $s .= $this->deleteThisPage(); }
if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); }
if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); }
}
@@ -1135,7 +1138,8 @@ END;
global $wgUser, $wgTitle, $wgRequest;
$diff = $wgRequest->getVal( 'diff' );
- if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
+// WERELATE: added title parm
+ if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete', $wgTitle) ) {
$t = wfMsg( 'deletethispage' );
$s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
@@ -1354,7 +1358,7 @@ END;
if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
return '';
}
-
+
# __NEWSECTIONLINK___ changes behaviour here
# If it's present, the link points to this page, otherwise
# it points to the talk page
@@ -1365,7 +1369,7 @@ END;
} else {
$title =& $wgTitle->getTalkPage();
}
-
+
return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
}
@@ -1453,7 +1457,7 @@ END;
$key = "{$wgDBname}:sidebar";
$cacheSidebar = $wgEnableSidebarCache &&
($wgLanguageCode == $wgContLanguageCode);
-
+
if ($cacheSidebar) {
$cachedsidebar = $parserMemc->get( $key );
if ($cachedsidebar!="") {
diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php
index 6657d38..4b0f234 100644
--- a/includes/SkinTemplate.php
+++ b/includes/SkinTemplate.php
@@ -32,6 +32,8 @@ if ( ! defined( 'MEDIAWIKI' ) )
*/
require_once 'GlobalFunctions.php';
+// WERELATE - added
+require_once("extensions/familytree/FamilyTreeUtil.php");
/**
* Wrapper object for MediaWiki's localization functions,
@@ -95,6 +97,9 @@ class SkinTemplate extends Skin {
*/
var $template;
+// WERELATE - added
+ var $trees;
+
/**#@-*/
/**
@@ -109,6 +114,8 @@ class SkinTemplate extends Skin {
$this->skinname = 'monobook';
$this->stylename = 'monobook';
$this->template = 'QuickTemplate';
+// WERELATE - added
+ $this->trees = null;
}
/**
@@ -404,6 +411,9 @@ class SkinTemplate extends Skin {
}
wfProfileOut( "$fname-stuff4" );
+// WERELATE - added trees
+ $tpl->setRef('trees', $this->getTrees());
+
# Personal toolbar
$tpl->set('personal_urls', $this->buildPersonalUrls());
$content_actions = $this->buildContentActionUrls();
@@ -434,6 +444,17 @@ class SkinTemplate extends Skin {
wfProfileOut( $fname );
}
+// WERELATE - added
+ function getTrees() {
+ if ($this->trees == null) {
+ $this->trees = array();
+ if ($this->mUser->isLoggedIn() && FamilyTreeUtil::isTreePage($this->mTitle->getNamespace(), $this->mTitle->getDBkey())) {
+ $this->trees = FamilyTreeUtil::getOwnerTrees($this->mUser, $this->mTitle, true);
+ }
+ }
+ return $this->trees;
+ }
+
/**
* Output the string, or print error message if it's
* an error object of the appropriate type.
@@ -530,7 +551,7 @@ class SkinTemplate extends Skin {
}
}
- wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$wgTitle ) );
+ wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$wgTitle ) );
wfProfileOut( $fname );
return $personal_urls;
}
@@ -543,6 +564,15 @@ class SkinTemplate extends Skin {
return $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] );
}
+// WERELATE: added function
+ function getMsgOrEmpty($message) {
+ $text = wfMsg($message);
+ if ($text == "<$message>") {
+ return '';
+ }
+ return $text;
+ }
+
function tabAction( $title, $message, $selected, $query='', $checkEdit=false ) {
$classes = array();
if( $selected ) {
@@ -550,18 +580,21 @@ class SkinTemplate extends Skin {
}
if( $checkEdit && $title->getArticleId() == 0 ) {
$classes[] = 'new';
- $query = 'action=edit';
+// WERELATE: removed action=edit
+// $query = 'action=edit';
}
$text = wfMsg( $message );
if ( $text == "<$message>" ) {
global $wgContLang;
- $text = $wgContLang->getNsText( Namespace::getSubject( $title->getNamespace() ) );
+ $text = $wgContLang->getNsText( Namespac::getSubject( $title->getNamespace() ) );
}
+// WERELATE: added title attribute
return array(
'class' => implode( ' ', $classes ),
'text' => $text,
+ 'title' => $this->getMsgOrEmpty($message.'tip'),
'href' => $title->getLocalUrl( $query ) );
}
@@ -621,27 +654,33 @@ class SkinTemplate extends Skin {
'',
true);
- wfProfileIn( "$fname-edit" );
+// WERELATE: added title attributes; switch order of edit and addsection
+ wfProfileIn( "$fname-edit" );
if ( $this->mTitle->userCanEdit() && ( $this->mTitle->exists() || $this->mTitle->userCanCreate() ) ) {
$istalk = $this->mTitle->isTalkPage();
$istalkclass = $istalk?' istalk':'';
- $content_actions['edit'] = array(
- 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
- 'text' => wfMsg('edit'),
- 'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() )
- );
if ( $istalk || $wgOut->showNewSectionLink() ) {
$content_actions['addsection'] = array(
'class' => $section == 'new'?'selected':false,
'text' => wfMsg('addsection'),
+ 'title' => $this->getMsgOrEmpty('addsectiontip'),
'href' => $this->mTitle->getLocalUrl( 'action=edit§ion=new' )
);
}
+
+ $content_actions['edit'] = array(
+ 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
+ 'text' => wfMsg('edit'),
+ 'title' => $this->getMsgOrEmpty('edittip'),
+ 'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() )
+ );
+
} else {
$content_actions['viewsource'] = array(
'class' => ($action == 'edit') ? 'selected' : false,
'text' => wfMsg('viewsource'),
+ 'title' => $this->getMsgOrEmpty('viewsourcetip'),
'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() )
);
}
@@ -653,6 +692,7 @@ class SkinTemplate extends Skin {
$content_actions['history'] = array(
'class' => ($action == 'history') ? 'selected' : false,
'text' => wfMsg('history_short'),
+ 'title' => $this->getMsgOrEmpty('historytip'),
'href' => $this->mTitle->getLocalUrl( 'action=history')
);
@@ -661,6 +701,7 @@ class SkinTemplate extends Skin {
$content_actions['protect'] = array(
'class' => ($action == 'protect') ? 'selected' : false,
'text' => wfMsg('protect'),
+ 'title' => $this->getMsgOrEmpty('protecttip'),
'href' => $this->mTitle->getLocalUrl( 'action=protect' )
);
@@ -668,14 +709,17 @@ class SkinTemplate extends Skin {
$content_actions['unprotect'] = array(
'class' => ($action == 'unprotect') ? 'selected' : false,
'text' => wfMsg('unprotect'),
+ 'title' => $this->getMsgOrEmpty('unprotecttip'),
'href' => $this->mTitle->getLocalUrl( 'action=unprotect' )
);
}
}
- if($wgUser->isAllowed('delete')){
+// WERELATE: added title parm to isAllowed
+ if($wgUser->isAllowed('delete', $this->mTitle)){
$content_actions['delete'] = array(
'class' => ($action == 'delete') ? 'selected' : false,
'text' => wfMsg('delete'),
+ 'title' => $this->getMsgOrEmpty('deletetip'),
'href' => $this->mTitle->getLocalUrl( 'action=delete' )
);
}
@@ -684,17 +728,20 @@ class SkinTemplate extends Skin {
$content_actions['move'] = array(
'class' => ($this->mTitle->getDbKey() == 'Movepage' and $this->mTitle->getNamespace == NS_SPECIAL) ? 'selected' : false,
'text' => wfMsg('move'),
+ 'title' => $this->getMsgOrEmpty('movetip'),
'href' => $moveTitle->getLocalUrl( 'target=' . urlencode( $this->thispage ) )
);
}
} else {
//article doesn't exist or is deleted
- if( $wgUser->isAllowed( 'delete' ) ) {
+// WERELATE: added title parm; undelete action
+ if( $wgUser->isAllowed( 'undelete', $this->mTitle ) ) {
if( $n = $this->mTitle->isDeleted() ) {
$undelTitle = Title::makeTitle( NS_SPECIAL, 'Undelete' );
$content_actions['undelete'] = array(
'class' => false,
'text' => wfMsgExt( 'undelete_short', array( 'parsemag' ), $n ),
+ 'title' => $this->getMsgOrEmpty('undeletetip'),
'href' => $undelTitle->getLocalUrl( 'target=' . urlencode( $this->thispage ) )
#'href' => $this->makeSpecialUrl("Undelete/$this->thispage")
);
@@ -708,12 +755,14 @@ class SkinTemplate extends Skin {
$content_actions['watch'] = array(
'class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false,
'text' => wfMsg('watch'),
+ 'title' => $this->getMsgOrEmpty('watchtip'),
'href' => $this->mTitle->getLocalUrl( 'action=watch' )
);
} else {
$content_actions['unwatch'] = array(
'class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false,
'text' => wfMsg('unwatch'),
+ 'title' => $this->getMsgOrEmpty('unwatchtip'),
'href' => $this->mTitle->getLocalUrl( 'action=unwatch' )
);
}
@@ -961,7 +1010,7 @@ class SkinTemplate extends Skin {
wfProfileIn( $fname );
$out = false;
wfRunHooks( 'SkinTemplateSetupPageCss', array( &$out ) );
-
+
wfProfileOut( $fname );
return $out;
}
diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php
index b3f67ab..17fe4913 100644
--- a/includes/SpecialBlockip.php
+++ b/includes/SpecialBlockip.php
@@ -96,6 +96,17 @@ class IPBlockForm {
$token = htmlspecialchars( $wgUser->editToken() );
+// WERELATE - add blockNotice here and in addHTML below
+ $blockNotice = '';
+ if ($this->BlockAddress) {
+ $dbr =& wfGetDB( DB_SLAVE );
+ $expiryDate = $dbr->selectField('ipblocks', 'ipb_expiry', array('ipb_address' => $this->BlockAddress));
+ if ($expiryDate) {
+ global $wgLang;
+ $blockNotice = wfMsg('userblocked', $wgLang->timeanddate(wfTimestamp( TS_MW, $expiryDate )));
+ }
+ }
+
$wgOut->addHTML( "
|